export default {
    state: {
        countInfo: []
    },
    mutations: {
        counts(state, val) {
            state.countInfo = val
        }
    },
    getters: {
        getcount(state) {
            var sum = 0
            state.countInfo.forEach(n => {
                if (n.isEffective == true) {
                    sum += n.count
                }
            });
            return sum
        },
        getcounts(state){
            var sum = 0
            state.countInfo.forEach(n => {
                if (n.selected == true) {
                    sum += n.count
                }
            });
            return sum
        },
        getmoney(state) {
            var sum = 0
            state.countInfo.forEach(n => {
                sum += n.count * n.price
            });
            return sum
        }
    }
}